package com.wteam.dragon.shop.pojo.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.gitee.sunchenbin.mybatis.actable.annotation.*;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import com.wteam.dragon.system.basebean.bean.BaseBean;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 优惠卷
 * @Author 陈晓辉
 * @Date 2021/3/24 20:01
 */
@Data
@Table
@TableName
@EqualsAndHashCode(callSuper = true)
public class Coupon extends BaseBean {
    @IsKey
    @IsNotNull
    @IsAutoIncrement
    @TableId(type = IdType.AUTO)
    @ColumnType(MySqlTypeConstant.BIGINT)
    @Column(comment = "自增id")
    private Long id;

    @IsNotNull
    @Column(comment = "优惠券类型 (0 全场赠券 1 会员赠券 2 购物赠券 3 注册赠券)")
    @ColumnType(MySqlTypeConstant.TINYINT)
    @DefaultValue("0")
    private Integer type;

    @Column(comment = "优惠卷名")
    @ColumnType(MySqlTypeConstant.VARCHAR)
    private String name;

    @IsNotNull
    @Column(comment = "使用平台 (0 全部 1 移动 2 PC)")
    @ColumnType(MySqlTypeConstant.TINYINT)
    @DefaultValue("0")
    private Integer platform;

    @Column(comment = "数量")
    @ColumnType(MySqlTypeConstant.INT)
    private Integer count;

    @IsNotNull
    @Column(comment = "金额")
    @ColumnType(value = MySqlTypeConstant.DECIMAL, length = 12, decimalLength = 2)
    private BigDecimal amount;

    @IsNotNull
    @Column(comment = "每人限领张数")
    @ColumnType(MySqlTypeConstant.INT)
    @DefaultValue("1")
    private Integer perLimit;

    @IsNotNull
    @Column(comment = "使用门槛 0表示无门槛")
    @ColumnType(value = MySqlTypeConstant.DECIMAL, length = 12, decimalLength = 2)
    @DefaultValue("0")
    private BigDecimal minPoint;

    @IsNotNull
    @Column(comment = "开始时间")
    @ColumnType(value = MySqlTypeConstant.TIMESTAMP)
    private Date startTime;

    @IsNotNull
    @Column(comment = "结束时间")
    @ColumnType(value = MySqlTypeConstant.TIMESTAMP)
    private Date endTime;

    @IsNotNull
    @Column(comment = "使用类型 0 全场通用 1 指定分类 2 指定商品")
    @ColumnType(value = MySqlTypeConstant.TINYINT)
    @DefaultValue("0")
    private Integer useType;

    @Column(comment = "备注")
    @ColumnType(value = MySqlTypeConstant.TINYINT)
    private String note;

    @IsNotNull
    @Column(comment = "发行数量")
    @ColumnType(value = MySqlTypeConstant.INT)
    @DefaultValue("0")
    private Integer publishCount;

    @IsNotNull
    @Column(comment = "已使用数量")
    @ColumnType(value = MySqlTypeConstant.INT)
    @DefaultValue("0")
    private Integer useCount;

    @IsNotNull
    @Column(comment = "领取数量")
    @ColumnType(value = MySqlTypeConstant.INT)
    @DefaultValue("0")
    private Integer receiveCount;

    @IsNotNull
    @Column(comment = "截止领取时间")
    @ColumnType(value = MySqlTypeConstant.TIMESTAMP)
    private Date enableTime;

    @Column(comment = "优惠码")
    @ColumnType(value = MySqlTypeConstant.VARCHAR)
    private String code;

    @IsNotNull
    @Column(comment = "可领取的会员类型 0 无限制")
    @ColumnType(value = MySqlTypeConstant.VARCHAR)
    @DefaultValue("0")
    private Integer memberLevel;

}
